package Logger;

use strict;
use Data::Dumper;
use Conf;
use Utils;

my $conf = Conf->show;

our $Quiet = 0;

#sub new {
#	my ($class) = @_;
#	my $logfile = $conf->{LOG_FILE};
#	my $self = { logfile => $logfile };
#	bless $self, $class;
#	return $self;
#	
#}

sub write {
	my $self = shift;
	my ($text) = @_;
	open LOGFILE, ">>".$conf->{DEBUG_LOGFILE} or warn "Can't open logfile : $!";
	print LOGFILE Utils::current_timestamp()." ".$text."\n";
	if (!$Quiet) {
#		print LOGFILE Utils::current_timestamp()." Quiet = $Quiet";
#		warn Utils::current_timestamp()." ".$text."\n";
	}
	close LOGFILE;
}

sub set_quiet {
	my $self = shift;
	$Quiet = 1;
}

1;

